package com.hdy.web.controller;

import com.hdy.web.dao.LostObjectMapper;
import com.hdy.web.pojo.LostObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class AddController {
    final LostObjectMapper lostObjectMapper;

    public AddController(LostObjectMapper lostObjectMapper) {
        this.lostObjectMapper = lostObjectMapper;
    }
    @RequestMapping("/add")
    public String addObject(@RequestParam("lostName") String lostName,
                            @RequestParam("lostPosition") String lostPosition,
                            @RequestParam("lostDescription") String lostDescription,
                            @RequestParam("claimPosition") String claimPosition
                                ){
        LostObject lostObject = new LostObject();
        lostObjectMapper.addObject(lostObject,lostName,lostPosition,lostDescription,claimPosition);
        return "redirect:cklist";
    }

}
